<%--
  Created by IntelliJ IDEA.
  User: CURRY
  Date: 2021/10/13
  Time: 19:40
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    <meta name="renderer" content="webkit">
    <title></title>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/css/pintuer.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/css/admin.css">
    <script src="${pageContext.request.contextPath}/static/js/jquery.js"></script>
    <script src="${pageContext.request.contextPath}/static/js/pintuer.js"></script>
</head>
<body>
<div class="panel admin-panel">
    <div class="panel-head"><strong><span class="icon-pencil-square-o"></span> 预约信息</strong></div>
    <div class="body-content">
        <form method="post" class="form-x" action="">
            <div class="form-group">
                <div class="label">
                    <label>姓名：</label>
                </div>
                <div class="field">
                    <input type="text" class="input" name="name" id="name"  />
                    <div class="tips"></div>
                </div>
            </div>
            <div class="form-group">
                <div class="label">
                    <label>年龄：</label>
                </div>
                <div class="field">
                    <input type="text" class="input" name="age" id="age"  />
                    <div class="tips"></div>
                </div>
            </div>
            <div class="form-group">
                <div class="label">
                    <label>性别：</label>
                </div>
                <div class="field">
                    <input type="text" class="input" name="sex" id="sex"  />
                    <div class="tips"></div>
                </div>
            </div>
            <div class="form-group">
                <div class="label">
                    <label>预约日期：</label>
                </div>
                <div class="field">
                    <input type="text" class="input" name="appointmentDate" id="appointmentDate"  />
                    <div class="tips"></div>
                </div>
            </div>
            <div class="form-group">
                <div class="label">
                    <label>预约医生：</label>
                </div>
                <div class="field">
                    <input type="text" class="input"name="doctor" id="doctor"  />
                    <div class="tips"></div>
                </div>
            </div>
            <div class="form-group">
                <div class="label">
                    <label>症状：</label>
                </div>
                <div class="field">
                    <input type="text" class="input" name="symptom" id="symptom"  />
                    <div class="tips"></div>
                </div>
            </div>
            <div class="form-group">
                <div class="label">
                    <label></label>
                </div>
                <div class="field">
                    <button class="button bg-main icon-check-square-o" type="button" onclick="ok()"> 提交</button>
                </div>
            </div>
        </form>
    </div>
</div>
<script>
    function ok() {
        $.ajax({
            url:"../appointment/addAppointment",
            dataType:"json",
            type:"post",

            data:{
                "name":$("#name").val(),
                "age":$("#age").val(),
                "sex":$("#sex").val(),
                "appointmentDate":$("#appointmentDate").val(),
                "doctor":$("#doctor").val(),
                "symptom":$("#symptom").val(),
            },
            success:function (data) {
                if(data.code == 200){
                    alert("预约成功");
                    window.location.reload();
                }else{
                    alert("预约失败");
                }
            },error:function () {
                alert("服务器错误");
            }
        })
    }
</script>
</body></html>